﻿<Window x:Class="WpfModelViewApplication2.Views.MainView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:c="http://CoreMVVM/Commands"
        xmlns:cmd="clr-namespace:WpfModelViewApplication2.AppCommands" Background="Wheat"
    Title="CoreMVVM Sample" Height="400" Width="800">
    
    <Window.Resources>
        <!-- Allows a KeyBinding to be associated with a command defined in the View Model  -->
        <c:CommandReference x:Key="ExitCommandReference" Command="{Binding ExitCommand}" />
    </Window.Resources>
   
    <Window.InputBindings>
        <KeyBinding Key="X" Modifiers="Control" Command="{StaticResource ExitCommandReference}" /> 
    </Window.InputBindings>
    
    <DockPanel>
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="_File">
                <MenuItem Command="{Binding OpenFileCommand}" Header="_Open"/>
                <MenuItem Command="{Binding OpenWindow1Command}" Header="_Window1"/>
                <MenuItem Command="{Binding ExitCommand}" Header="E_xit" InputGestureText="Ctrl-X" />
            </MenuItem>
        </Menu>
	
        <Grid DockPanel.Dock="Bottom">
            <!-- Add additional content here -->
            <TextBox Background="Beige" cmd:TextBoxTextChanged.Command ="{Binding TextChangedCommand}" AcceptsReturn="True" xml:space="preserve"  >
                1. Menu-Open --> Opens a dialog through a Service Provider
                2. Menu-Window1 --> Same as 1. Opens Window1
                    a. The textbox in Window1 listens to messages broadcast through the Mediator. Performing Step1 will populate the textbox
                3. This Textbox uses a command with attached TextChangedBehavior for the TextChanged event. Typed text goes into Window title.
                
            </TextBox>
        </Grid>
    </DockPanel>
</Window>
